a, b, c, d, e = map(int, input().split())
a //= 3
b += a
e += a
b //= 3
a += b
c += b
c //= 3
b += c
d += c
d //= 3
c += d
e += d
e //= 3
d += e
a += e
print(f"{a:5}{b:5}{c:5}{d:5}{e:5}")